﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InfernoWarriors.Engine
{
    public class UnitBase 
    {
        public Guid ID { get; private set; }
        protected int Health { get; set; }
        protected int Armory { get; set; }
        protected Team SideOfConflict { get; set; }
        protected int NumberOfShots { get; set; }
        protected double Accuracy { get; set; }

        public bool IsShotVisible { get; set; }

        public UnitBase() 
            : this(1, 0, Team.Default, 1, 0.3) { }
       
        public UnitBase(
            int health, 
            int armory, 
            Team sideOfConflict, 
            int numberofShots, 
            double accuracy)
        {
            ID = Guid.NewGuid();
            Health = health;
            Armory = armory;
            SideOfConflict = sideOfConflict;
            NumberOfShots = numberofShots;
            Accuracy = accuracy;
        }

        public bool MakeShot(UnitBase unitOnTarget)
        {
            Random rn = new Random();
            if (rn.NextDouble() <= (double)this.Accuracy)
                return true;

            return false;
        }


    }

    public enum Team
    {
        Default = 0,
        Red = 1,
        Blue = 2,
        Green = 3
    }
}


